<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // 接收表单数据
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['tell'];
    $gender = isset($_POST['gander']) ? $_POST['gander'] : '';
    $hobbies = isset($_POST['hoby']) ? $_POST['hoby'] : [];
    $address = $_POST['addr'];
    $introduction = $_POST['intro'];

    // 处理数据（这里可以添加更多的数据验证和处理逻辑）
} else {
    // 如果不是POST请求，则重定向回表单页面
    header("Location: test1.html");
    exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单提交结果</title>
</head>
<body>
    <h1>您提交的信息如下：</h1>
    <p><strong>姓名：</strong><?php echo htmlspecialchars($name); ?></p>
    <p><strong>邮箱：</strong><?php echo htmlspecialchars($email); ?></p>
    <p><strong>手机号：</strong><?php echo htmlspecialchars($phone); ?></p>
    <p><strong>性别：</strong><?php echo htmlspecialchars($gender); ?></p>
    <p><strong>爱好：</strong>
        <?php
        if (is_array($hobbies)) {
            foreach ($hobbies as $hobby) {
                echo htmlspecialchars($hobby) . ' ';
            }
        } else {
            echo htmlspecialchars($hobbies);
        }
        ?>
    </p>
    <p><strong>地址：</strong><?php echo htmlspecialchars($address); ?></p>
    <p><strong>自我介绍：</strong><?php echo htmlspecialchars($introduction); ?></p>
</body>
</html>